require(list)

#### data preparation ####
FtF.data <- read.csv("FtF_data.csv")
online.data <- read.csv("online_data.csv")

## reversed-coded DQ outcome for combinedListDirect()
FtF.data$DQ.rev <- 1 - FtF.data$DQ
online.data$DQ.rev <- 1 - online.data$DQ

## reversed-coded list outcome for combinedListDirect()
FtF.data$list.rev <- ifelse(FtF.data$treatment == 1, 
                            4 - FtF.data$list, 3 - FtF.data$list)
online.data$list.rev <- ifelse(online.data$treatment == 1, 
                               4 - online.data$list, 3 - online.data$list)

## young-respondent subset of the face-to-face data
FtF.young.data <- subset(FtF.data, age < 45)

# dichotomize social media use
FtF.data$social.media.d <- (FtF.data$social.media > 1) * 1
online.data$social.media.d <- (online.data$social.media > 1) * 1

# dichotomize popularity in neighborhood
FtF.data$neighborhood.d <- (FtF.data$neighborhood > 2) * 1
online.data$neighborhood.d <- (online.data$neighborhood > 2) * 1

## function for subgroup comparison of SDB
SDB.group.RC3.test <- function(y, x, FtF.data, treat, DQ) {
  temp.data.1 <- subset(FtF.data, FtF.data[, x] == 0)
  n.obs.1 <- nrow(temp.data.1)
  list.reg.1 <- combinedListDirect(formula(paste0(y, " ~ ", treat)), 
                                   data = temp.data.1, 
                                   treat = treat, direct = DQ)
  list.est.1 <- 1 - list.reg.1$comb.est
  list.se.1 <- list.reg.1$comb.se
  DQ.est.1 <- 1 - list.reg.1$direct.est
  DQ.se.1 <- list.reg.1$direct.se
  SDB.est.1 <- DQ.est.1 - list.est.1
  SDB.se.1 <- sqrt(list.se.1 ^ 2 + DQ.se.1 ^ 2)
  SDB.p.1 <- (1 - pnorm(abs(SDB.est.1 / SDB.se.1))) * 2
  temp.data.2 <- subset(FtF.data, FtF.data[, x] == 1)
  n.obs.2 <- nrow(temp.data.2)
  list.reg.2 <- combinedListDirect(formula(paste0(y, " ~ ", treat)), 
                                   data = temp.data.2, 
                                   treat = treat, direct = DQ)
  list.est.2 <- 1 - list.reg.2$comb.est
  list.se.2 <- list.reg.2$comb.se
  DQ.est.2 <- 1 - list.reg.2$direct.est
  DQ.se.2 <- list.reg.2$direct.se
  SDB.est.2 <- DQ.est.2 - list.est.2
  SDB.se.2 <- sqrt(list.se.2 ^ 2 + DQ.se.2 ^ 2)
  SDB.p.2 <- (1 - pnorm(abs(SDB.est.2 / SDB.se.2))) * 2
  SDB.diff.est <- SDB.est.2 - SDB.est.1
  SDB.diff.se <- sqrt(list.se.1 ^ 2 + DQ.se.1 ^ 2 + list.se.2 ^ 2 + DQ.se.2 ^ 2)
  SDB.diff.p <- (1 - pnorm(abs(SDB.diff.est / SDB.diff.se))) * 2
  out <- list(summary = c(SDB.est.1, SDB.est.2, SDB.diff.est, 
                          SDB.diff.est + qnorm(0.025) * SDB.diff.se, 
                          SDB.diff.est + qnorm(0.975) * SDB.diff.se, 
                          SDB.diff.p), 
              details = list(SDB.est.1 = SDB.est.1, SDB.se.1 = SDB.se.1, 
                             SDB.p.1 = SDB.p.1, n.obs.1 = n.obs.1, 
                             SDB.est.2 = SDB.est.2, SDB.se.2 = SDB.se.2, 
                             SDB.p.2 = SDB.p.2, n.obs.2 = n.obs.2, 
                             SDB.diff.est = SDB.diff.est, 
                             SDB.diff.se = SDB.diff.se, 
                             SDB.diff.p = SDB.diff.p))
  names(out$summary) <- c("SDB est (x = 0)", "SDB est (x = 1)", "SDB diff est", 
                          "SDB diff lower", "SDB diff upper", "SDB diff p")
  out
}

#### estimates by combining list experimentation and DQ (Appendix B.3) ####
## test of Hypothesis 1 (FtF)
Aronow.et.al.FtF <- combinedListDirect(list.rev ~ treatment, data = FtF.data, 
                                       treat = "treatment", direct = "DQ.rev")

DQ.est.RC3.FtF <- 1 - Aronow.et.al.FtF$direct.est
DQ.se.RC3.FtF <- Aronow.et.al.FtF$direct.se

list.est.RC3.FtF <- 1 - Aronow.et.al.FtF$comb.est
list.se.RC3.FtF <- Aronow.et.al.FtF$comb.se

SDB.est.RC3.FtF <- DQ.est.RC3.FtF - list.est.RC3.FtF
SDB.se.RC3.FtF <- sqrt(list.se.RC3.FtF ^ 2 + DQ.se.RC3.FtF ^ 2)

## test of Hypothesis 1 (online)
Aronow.et.al.online <- combinedListDirect(list.rev ~ treatment, data = online.data, 
                                          treat = "treatment", direct = "DQ.rev")

DQ.est.RC3.online <- 1 - Aronow.et.al.online$direct.est
DQ.se.RC3.online <- Aronow.et.al.online$direct.se

list.est.RC3.online <- 1 - Aronow.et.al.online$comb.est
list.se.RC3.online <- Aronow.et.al.online$comb.se

SDB.est.RC3.online <- DQ.est.RC3.online - list.est.RC3.online
SDB.se.RC3.online <- sqrt(list.se.RC3.online ^ 2 + DQ.se.RC3.online ^ 2)

## test of Hypothesis 2
Aronow.et.al.FtF.young <- combinedListDirect(list.rev ~ treatment, 
                                             data = FtF.young.data, 
                                             treat = "treatment", 
                                             direct = "DQ.rev")

DQ.est.RC3.FtF.young <- 1 - Aronow.et.al.FtF.young$direct.est
DQ.se.RC3.FtF.young <- Aronow.et.al.FtF.young$direct.se

list.est.RC3.FtF.young <- 1 - Aronow.et.al.FtF.young$comb.est
list.se.RC3.FtF.young <- Aronow.et.al.FtF.young$comb.se

SDB.est.RC3.FtF.young <- DQ.est.RC3.FtF.young - list.est.RC3.FtF.young
SDB.se.RC3.FtF.young <- sqrt(list.se.RC3.FtF.young ^ 2 + 
                               DQ.se.RC3.FtF.young ^ 2)

SDB.diff.est.RC3 <- SDB.est.RC3.FtF.young - SDB.est.RC3.online
SDB.diff.se.RC3 <- sqrt(list.se.RC3.FtF.young ^ 2 + DQ.se.RC3.FtF.young ^ 2 + 
                          list.se.RC3.online ^ 2 + DQ.se.RC3.online ^ 2)

## tests of Hypotheses 3-6 (FtF)
EJK.RC3.result.FtF <- SDB.group.RC3.test("list.rev", "EJK", FtF.data, 
                                         "treatment", "DQ.rev")

RT.RC3.result.FtF <- SDB.group.RC3.test("list.rev", "RT", FtF.data, 
                                        "treatment", "DQ.rev")

social.media.RC3.result.FtF <- SDB.group.RC3.test("list.rev", "social.media.d", 
                                                  FtF.data, 
                                                  "treatment", "DQ.rev")

neighborhood.RC3.result.FtF <- SDB.group.RC3.test("list.rev", "neighborhood.d", 
                                                  FtF.data, 
                                                  "treatment", "DQ.rev")

## tests of Hypotheses 3-6 (online)
EJK.RC3.result.online <- SDB.group.RC3.test("list.rev", "EJK", online.data, 
                                            "treatment", "DQ.rev")

RT.RC3.result.online <- SDB.group.RC3.test("list.rev", "RT", online.data, 
                                           "treatment", "DQ.rev")

social.media.RC3.result.online <- SDB.group.RC3.test("list.rev", "social.media.d", 
                                                     online.data, 
                                                     "treatment", "DQ.rev")

neighborhood.RC3.result.online <- SDB.group.RC3.test("list.rev", "neighborhood.d", 
                                                     online.data, 
                                                     "treatment", "DQ.rev")

#### Figure A.6 ####
cairo_pdf("Figure_A6.pdf", width = 4.5, height = 3.2, pointsize = 9)
par(mar = c(4, 0, 1, 1), lwd = 0.5)
plot(NULL, NULL, bty = "n", xlim = c(-0.9, 1), ylim = c(0, 14), 
     main = "", xlab = "", ylab = "", xaxt = "n", yaxt = "n")
segments(-0.05, c(1, 3:5, 7:9, 11:13), 1.05, c(1, 3:5, 7:9, 11:13), 
         lty = 3, col = "gray")
abline(v = seq(0, 1, 0.2), col = "gray")
points(DQ.est.RC3.FtF, 13, pch = 4)
segments(DQ.est.RC3.FtF + qnorm(0.025) * DQ.se.RC3.FtF, 13, 
         DQ.est.RC3.FtF + qnorm(0.975) * DQ.se.RC3.FtF, 13)
points(list.est.RC3.FtF, 12, pch = 4)
segments(list.est.RC3.FtF + qnorm(0.025) * list.se.RC3.FtF, 12, 
         list.est.RC3.FtF + qnorm(0.975) * list.se.RC3.FtF, 12)
points(SDB.est.RC3.FtF, 11, pch = 19)
segments(SDB.est.RC3.FtF + qnorm(0.025) * SDB.se.RC3.FtF, 11, 
         SDB.est.RC3.FtF + qnorm(0.975) * SDB.se.RC3.FtF, 11)
points(DQ.est.RC3.FtF.young, 9, pch = 4)
segments(DQ.est.RC3.FtF.young + qnorm(0.025) * DQ.se.RC3.FtF.young, 9, 
         DQ.est.RC3.FtF.young + qnorm(0.975) * DQ.se.RC3.FtF.young, 9)
points(list.est.RC3.FtF.young, 8, pch = 4)
segments(list.est.RC3.FtF.young + qnorm(0.025) * list.se.RC3.FtF.young, 8, 
         list.est.RC3.FtF.young + qnorm(0.975) * list.se.RC3.FtF.young, 8)
points(SDB.est.RC3.FtF.young, 7, pch = 19)
segments(SDB.est.RC3.FtF.young + qnorm(0.025) * SDB.se.RC3.FtF.young, 7, 
         SDB.est.RC3.FtF.young + qnorm(0.975) * SDB.se.RC3.FtF.young, 7)
points(DQ.est.RC3.online, 5, pch = 4)
segments(DQ.est.RC3.online + qnorm(0.025) * DQ.se.RC3.online, 5, 
         DQ.est.RC3.online + qnorm(0.975) * DQ.se.RC3.online, 5)
points(list.est.RC3.online, 4, pch = 4)
segments(list.est.RC3.online + qnorm(0.025) * list.se.RC3.online, 4, 
         list.est.RC3.online + qnorm(0.975) * list.se.RC3.online, 4)
points(SDB.est.RC3.online, 3, pch = 19)
segments(SDB.est.RC3.online + qnorm(0.025) * SDB.se.RC3.online, 3, 
         SDB.est.RC3.online + qnorm(0.975) * SDB.se.RC3.online, 3)
points(SDB.diff.est.RC3, 1, pch = 19)
segments(SDB.diff.est.RC3 + qnorm(0.025) * SDB.diff.se.RC3, 1, 
         SDB.diff.est.RC3 + qnorm(0.975) * SDB.diff.se.RC3, 1)
text(-0.9, 14, "Face-to-face survey (entire)", pos = 4, font = 2)
text(-0.8, 13, "Direct question", pos = 4)
text(-0.8, 12, "List question", pos = 4)
text(-0.8, 11, "Difference b/w questions", pos = 4)
text(-0.9, 10, "Face-to-face survey (18\u201344)", pos = 4, font = 2)
text(-0.8, 9, "Direct question", pos = 4)
text(-0.8, 8, "List question", pos = 4)
text(-0.8, 7, "Difference b/w questions", pos = 4)
text(-0.9, 6, "Online survey", pos = 4, font = 2)
text(-0.8, 5, "Direct question", pos = 4)
text(-0.8, 4, "List question", pos = 4)
text(-0.8, 3, "Difference b/w questions", pos = 4)
text(-0.9, 1, "Difference in differences\nb/w survey modes", pos = 4, font = 2)
axis(1, seq(0, 1, 0.2), lwd = 0.5)
mtext("Approval rate (or its difference)", side = 1, line = 2.5, at = 0.5)
dev.off()

#### Figure A.7 ####
cairo_pdf("Figure_A7.pdf", width = 5, height = 7, pointsize = 9)
layout(matrix(1:2, 2, 1))
par(mar = c(4, 0, 3, 1), lwd = 0.5)
plot(NULL, NULL, bty = "n", xlim = c(-2.5, 1), ylim = c(0, 16), 
     main = "Face-to-face survey", xlab = "", ylab = "", xaxt = "n", yaxt = "n")
segments(-0.8, c(1:3, 5:7, 9:11, 13:15), 1.05, c(1:3, 5:7, 9:11, 13:15), 
         lty = 3, col = "gray")
abline(v = seq(-0.75, 1, 0.25), col = "gray")
points(EJK.RC3.result.FtF$details$SDB.est.1, 15, pch = 4)
segments(EJK.RC3.result.FtF$details$SDB.est.1 + 
           qnorm(0.025) * EJK.RC3.result.FtF$details$SDB.se.1, 15, 
         EJK.RC3.result.FtF$details$SDB.est.1 + 
           qnorm(0.975) * EJK.RC3.result.FtF$details$SDB.se.1, 15)
points(EJK.RC3.result.FtF$details$SDB.est.2, 14, pch = 4)
segments(EJK.RC3.result.FtF$details$SDB.est.2 + 
           qnorm(0.025) * EJK.RC3.result.FtF$details$SDB.se.2, 14, 
         EJK.RC3.result.FtF$details$SDB.est.2 + 
           qnorm(0.975) * EJK.RC3.result.FtF$details$SDB.se.2, 14)
points(EJK.RC3.result.FtF$details$SDB.diff.est, 13, pch = 19)
segments(EJK.RC3.result.FtF$details$SDB.diff.est + 
           qnorm(0.025) * EJK.RC3.result.FtF$details$SDB.diff.se, 13, 
         EJK.RC3.result.FtF$details$SDB.diff.est + 
           qnorm(0.975) * EJK.RC3.result.FtF$details$SDB.diff.se, 13)
points(RT.RC3.result.FtF$details$SDB.est.1, 11, pch = 4)
segments(RT.RC3.result.FtF$details$SDB.est.1 + 
           qnorm(0.025) * RT.RC3.result.FtF$details$SDB.se.1, 11, 
         RT.RC3.result.FtF$details$SDB.est.1 + 
           qnorm(0.975) * RT.RC3.result.FtF$details$SDB.se.1, 11)
points(RT.RC3.result.FtF$details$SDB.est.2, 10, pch = 4)
segments(RT.RC3.result.FtF$details$SDB.est.2 + 
           qnorm(0.025) * RT.RC3.result.FtF$details$SDB.se.2, 10, 
         RT.RC3.result.FtF$details$SDB.est.2 + 
           qnorm(0.975) * RT.RC3.result.FtF$details$SDB.se.2, 10)
points(RT.RC3.result.FtF$details$SDB.diff.est, 9, pch = 19)
segments(RT.RC3.result.FtF$details$SDB.diff.est + 
           qnorm(0.025) * RT.RC3.result.FtF$details$SDB.diff.se, 9, 
         RT.RC3.result.FtF$details$SDB.diff.est + 
           qnorm(0.975) * RT.RC3.result.FtF$details$SDB.diff.se, 9)
points(social.media.RC3.result.FtF$details$SDB.est.1, 7, pch = 4)
segments(social.media.RC3.result.FtF$details$SDB.est.1 + 
           qnorm(0.025) * social.media.RC3.result.FtF$details$SDB.se.1, 7, 
         social.media.RC3.result.FtF$details$SDB.est.1 + 
           qnorm(0.975) * social.media.RC3.result.FtF$details$SDB.se.1, 7)
points(social.media.RC3.result.FtF$details$SDB.est.2, 6, pch = 4)
segments(social.media.RC3.result.FtF$details$SDB.est.2 + 
           qnorm(0.025) * social.media.RC3.result.FtF$details$SDB.se.2, 6, 
         social.media.RC3.result.FtF$details$SDB.est.2 + 
           qnorm(0.975) * social.media.RC3.result.FtF$details$SDB.se.2, 6)
points(social.media.RC3.result.FtF$details$SDB.diff.est, 5, pch = 19)
segments(social.media.RC3.result.FtF$details$SDB.diff.est + 
           qnorm(0.025) * social.media.RC3.result.FtF$details$SDB.diff.se, 5, 
         social.media.RC3.result.FtF$details$SDB.diff.est + 
           qnorm(0.975) * social.media.RC3.result.FtF$details$SDB.diff.se, 5)
points(neighborhood.RC3.result.FtF$details$SDB.est.1, 3, pch = 4)
segments(neighborhood.RC3.result.FtF$details$SDB.est.1 + 
           qnorm(0.025) * neighborhood.RC3.result.FtF$details$SDB.se.1, 3, 
         neighborhood.RC3.result.FtF$details$SDB.est.1 + 
           qnorm(0.975) * neighborhood.RC3.result.FtF$details$SDB.se.1, 3)
points(neighborhood.RC3.result.FtF$details$SDB.est.2, 2, pch = 4)
segments(neighborhood.RC3.result.FtF$details$SDB.est.2 + 
           qnorm(0.025) * neighborhood.RC3.result.FtF$details$SDB.se.2, 2, 
         neighborhood.RC3.result.FtF$details$SDB.est.2 + 
           qnorm(0.975) * neighborhood.RC3.result.FtF$details$SDB.se.2, 2)
points(neighborhood.RC3.result.FtF$details$SDB.diff.est, 1, pch = 19)
segments(neighborhood.RC3.result.FtF$details$SDB.diff.est + 
           qnorm(0.025) * neighborhood.RC3.result.FtF$details$SDB.diff.se, 1, 
         neighborhood.RC3.result.FtF$details$SDB.diff.est + 
           qnorm(0.975) * neighborhood.RC3.result.FtF$details$SDB.diff.se, 1)
text(-2.5, 16, "Extrajudicial killing", pos = 4, font = 2)
text(-2.35, 15, paste0("Do not know a victim (N=", 
                       format(EJK.RC3.result.FtF$details$n.obs.1, big.mark = ","), 
                       ")"), pos = 4)
text(-2.35, 14, paste0("Know a victim (N=", 
                       format(EJK.RC3.result.FtF$details$n.obs.2, big.mark = ","), 
                       ")"), pos = 4)
text(-2.35, 13, "Difference b/w groups", pos = 4)
text(-2.5, 12, "Red-tagging", pos = 4, font = 2)
text(-2.35, 11, paste0("Do not know a victim (N=", 
                       format(RT.RC3.result.FtF$details$n.obs.1, big.mark = ","), 
                       ")"), pos = 4)
text(-2.35, 10, paste0("Know a victim (N=", 
                       format(RT.RC3.result.FtF$details$n.obs.2, big.mark = ","), 
                       ")"), pos = 4)
text(-2.35, 9, "Difference b/w groups", pos = 4)
text(-2.5, 8, "Social media use", pos = 4, font = 2)
text(-2.35, 7, paste0("60 minutes or less (N=", 
                      format(social.media.RC3.result.FtF$details$n.obs.1, big.mark = ","), 
                      ")"), pos = 4)
text(-2.35, 6, paste0("More than 60 minutes (N=", 
                      format(social.media.RC3.result.FtF$details$n.obs.2, big.mark = ","), 
                      ")"), pos = 4)
text(-2.35, 5, "Difference b/w groups", pos = 4)
text(-2.5, 4, "Popularity in neighborhood", pos = 4, font = 2)
text(-2.35, 3, paste0("Dissatisfied (N=", 
                      format(neighborhood.RC3.result.FtF$details$n.obs.1, big.mark = ","), 
                      ")"), pos = 4)
text(-2.35, 2, paste0("Satisfied (N=", 
                      format(neighborhood.RC3.result.FtF$details$n.obs.2, big.mark = ","), 
                      ")"), pos = 4)
text(-2.35, 1, "Difference b/w groups", pos = 4)
axis(1, seq(-0.75, 1, 0.25), lwd = 0.5, labels = NA)
mtext(sprintf("%4.2f", seq(-0.75, 1, 0.25)), 
      side = 1, line = 1, at = seq(-0.75, 1, 0.25))
mtext("Magnitude of SDB (or its difference)", side = 1, line = 2.5, at = 0.125)
plot(NULL, NULL, bty = "n", xlim = c(-2.5, 1), ylim = c(0, 16), 
     main = "Online survey", xlab = "", ylab = "", xaxt = "n", yaxt = "n")
segments(-0.8, c(1:3, 5:7, 9:11, 13:15), 1.05, c(1:3, 5:7, 9:11, 13:15), 
         lty = 3, col = "gray")
abline(v = seq(-0.75, 1, 0.25), col = "gray")
points(EJK.RC3.result.online$details$SDB.est.1, 15, pch = 4)
segments(EJK.RC3.result.online$details$SDB.est.1 + 
           qnorm(0.025) * EJK.RC3.result.online$details$SDB.se.1, 15, 
         EJK.RC3.result.online$details$SDB.est.1 + 
           qnorm(0.975) * EJK.RC3.result.online$details$SDB.se.1, 15)
points(EJK.RC3.result.online$details$SDB.est.2, 14, pch = 4)
segments(EJK.RC3.result.online$details$SDB.est.2 + 
           qnorm(0.025) * EJK.RC3.result.online$details$SDB.se.2, 14, 
         EJK.RC3.result.online$details$SDB.est.2 + 
           qnorm(0.975) * EJK.RC3.result.online$details$SDB.se.2, 14)
points(EJK.RC3.result.online$details$SDB.diff.est, 13, pch = 19)
segments(EJK.RC3.result.online$details$SDB.diff.est + 
           qnorm(0.025) * EJK.RC3.result.online$details$SDB.diff.se, 13, 
         EJK.RC3.result.online$details$SDB.diff.est + 
           qnorm(0.975) * EJK.RC3.result.online$details$SDB.diff.se, 13)
points(RT.RC3.result.online$details$SDB.est.1, 11, pch = 4)
segments(RT.RC3.result.online$details$SDB.est.1 + 
           qnorm(0.025) * RT.RC3.result.online$details$SDB.se.1, 11, 
         RT.RC3.result.online$details$SDB.est.1 + 
           qnorm(0.975) * RT.RC3.result.online$details$SDB.se.1, 11)
points(RT.RC3.result.online$details$SDB.est.2, 10, pch = 4)
segments(RT.RC3.result.online$details$SDB.est.2 + 
           qnorm(0.025) * RT.RC3.result.online$details$SDB.se.2, 10, 
         RT.RC3.result.online$details$SDB.est.2 + 
           qnorm(0.975) * RT.RC3.result.online$details$SDB.se.2, 10)
points(RT.RC3.result.online$details$SDB.diff.est, 9, pch = 19)
segments(RT.RC3.result.online$details$SDB.diff.est + 
           qnorm(0.025) * RT.RC3.result.online$details$SDB.diff.se, 9, 
         RT.RC3.result.online$details$SDB.diff.est + 
           qnorm(0.975) * RT.RC3.result.online$details$SDB.diff.se, 9)
points(social.media.RC3.result.online$details$SDB.est.1, 7, pch = 4)
segments(social.media.RC3.result.online$details$SDB.est.1 + 
           qnorm(0.025) * social.media.RC3.result.online$details$SDB.se.1, 7, 
         social.media.RC3.result.online$details$SDB.est.1 + 
           qnorm(0.975) * social.media.RC3.result.online$details$SDB.se.1, 7)
points(social.media.RC3.result.online$details$SDB.est.2, 6, pch = 4)
segments(social.media.RC3.result.online$details$SDB.est.2 + 
           qnorm(0.025) * social.media.RC3.result.online$details$SDB.se.2, 6, 
         social.media.RC3.result.online$details$SDB.est.2 + 
           qnorm(0.975) * social.media.RC3.result.online$details$SDB.se.2, 6)
points(social.media.RC3.result.online$details$SDB.diff.est, 5, pch = 19)
segments(social.media.RC3.result.online$details$SDB.diff.est + 
           qnorm(0.025) * social.media.RC3.result.online$details$SDB.diff.se, 5, 
         social.media.RC3.result.online$details$SDB.diff.est + 
           qnorm(0.975) * social.media.RC3.result.online$details$SDB.diff.se, 5)
points(neighborhood.RC3.result.online$details$SDB.est.1, 3, pch = 4)
segments(neighborhood.RC3.result.online$details$SDB.est.1 + 
           qnorm(0.025) * neighborhood.RC3.result.online$details$SDB.se.1, 3, 
         neighborhood.RC3.result.online$details$SDB.est.1 + 
           qnorm(0.975) * neighborhood.RC3.result.online$details$SDB.se.1, 3)
points(neighborhood.RC3.result.online$details$SDB.est.2, 2, pch = 4)
segments(neighborhood.RC3.result.online$details$SDB.est.2 + 
           qnorm(0.025) * neighborhood.RC3.result.online$details$SDB.se.2, 2, 
         neighborhood.RC3.result.online$details$SDB.est.2 + 
           qnorm(0.975) * neighborhood.RC3.result.online$details$SDB.se.2, 2)
points(neighborhood.RC3.result.online$details$SDB.diff.est, 1, pch = 19)
segments(neighborhood.RC3.result.online$details$SDB.diff.est + 
           qnorm(0.025) * neighborhood.RC3.result.online$details$SDB.diff.se, 1, 
         neighborhood.RC3.result.online$details$SDB.diff.est + 
           qnorm(0.975) * neighborhood.RC3.result.online$details$SDB.diff.se, 1)
text(-2.5, 16, "Extrajudicial killing", pos = 4, font = 2)
text(-2.35, 15, paste0("Do not know a victim (N=", 
                       format(EJK.RC3.result.online$details$n.obs.1, big.mark = ","), 
                       ")"), pos = 4)
text(-2.35, 14, paste0("Know a victim (N=", 
                       format(EJK.RC3.result.online$details$n.obs.2, big.mark = ","), 
                       ")"), pos = 4)
text(-2.35, 13, "Difference b/w groups", pos = 4)
text(-2.5, 12, "Red-tagging", pos = 4, font = 2)
text(-2.35, 11, paste0("Do not know a victim (N=", 
                       format(RT.RC3.result.online$details$n.obs.1, big.mark = ","), 
                       ")"), pos = 4)
text(-2.35, 10, paste0("Know a victim (N=", 
                       format(RT.RC3.result.online$details$n.obs.2, big.mark = ","), 
                       ")"), pos = 4)
text(-2.35, 9, "Difference b/w groups", pos = 4)
text(-2.5, 8, "Social media use", pos = 4, font = 2)
text(-2.35, 7, paste0("60 minutes or less (N=", 
                      format(social.media.RC3.result.online$details$n.obs.1, big.mark = ","), 
                      ")"), pos = 4)
text(-2.35, 6, paste0("More than 60 minutes (N=", 
                      format(social.media.RC3.result.online$details$n.obs.2, big.mark = ","), 
                      ")"), pos = 4)
text(-2.35, 5, "Difference b/w groups", pos = 4)
text(-2.5, 4, "Popularity in neighborhood", pos = 4, font = 2)
text(-2.35, 3, paste0("Dissatisfied (N=", 
                      format(neighborhood.RC3.result.online$details$n.obs.1, big.mark = ","), 
                      ")"), pos = 4)
text(-2.35, 2, paste0("Satisfied (N=", 
                      format(neighborhood.RC3.result.online$details$n.obs.2, big.mark = ","), 
                      ")"), pos = 4)
text(-2.35, 1, "Difference b/w groups", pos = 4)
axis(1, seq(-0.75, 1, 0.25), lwd = 0.5, labels = NA)
mtext(sprintf("%4.2f", seq(-0.75, 1, 0.25)), 
      side = 1, line = 1, at = seq(-0.75, 1, 0.25))
mtext("Magnitude of SDB (or its difference)", side = 1, line = 2.5, at = 0.125)
dev.off()